package com.jiuyun.Servlet;

import com.jiuyun.dao.StudentDao;
import com.jiuyun.dao.impl.StudentDaoImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.SQLException;
import java.util.List;

@WebServlet("/stu/*")
public class StuedentServlet extends BaseServlet {


    StudentDao dao = new StudentDaoImpl();
    protected void find(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
           List list= null;
        try {
             list =dao.getStu();
            System.out.println(list);

        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }
        request.setAttribute("list",list);
        request.getRequestDispatcher("/student.jsp").forward(request,response);
    }

}
